package java_thinking.unit_14._14_7_Proxy.Excercise;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Desc:
 * @author: cww
 * @DateTime: 2020-02-26 9:52
 */

public class HelloServiceHandler implements InvocationHandler {
    private Object ob;

    public HelloServiceHandler(Object ob) {
        this.ob = ob;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("-----------AOP--------------");
        String s = (String) method.invoke(ob, args);
        System.out.println("invoke result: " + s);
        System.out.println("-----------AOP--------------");
        return s;
    }
}
